<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
		function dataList(url){
			return p=new Promise((resolve,reject)=>{
				var xhr=new XMLHttpRequest();
				xhr.open('GET',url);
				xhr.send(null)
				xhr.onreadystatechange=function(){
					if(xhr.readyState!==4)return 
					if(xhr.readyState===4&& xhr.status===200){
						resolve(xhr.responseText)
					}else{
						reject('获取数据失败')
					}
				}
			})
		}
		dataList('http://localhost:3000/data').then((data)=>{
			console.log(data)
			return dataList('http://localhost:3000/data1')
		}).then((data)=>{
			console.log(data)
		})
    </script>	
</body>

</html>